import Vue from 'vue'
import App from './App.vue'
import router from './router/index'
import store from './vuex/store'
import './tools/axios'
import './registerServiceWorker'
//引入font-awsome
//import '@/assets/css/font-awesome.css'
import '../node_modules/font-awesome/css/font-awesome.css'

// 导入mixin
import '@/mixin/mixin'
//导入ElementUI
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);

//导入 重置浏览器样式
import 'reset-css'

Vue.config.productionTip = false
console.log(process.env)

router.beforeEach((to,from,next)=>{
if(to.path == '/signin'){
    localStorage.removeItem('token');
    next();
}else{
    const token = localStorage.getItem("token");
    if(token){
      next();
    }else{
      next({path:'/signin',query:{redirect:to.path}})
    }
    
}
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
